<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:true">
		<table cellpadding="5" style="width:100%;">
			<input id="matchInstroduceId${(matchProjectItem.id)!}" name="id" type="hidden" value="${(matchIntroduceItem.id)!}" />
			<input id="matchProjectId${(matchProjectItem.id)!}" name="matchProjectId" type="hidden" value="${(matchProjectItem.id)!}" />
			<tr>
				<td>
					当前赛事：${(matchProjectItem.matName)!}
					;
					赛事介绍发布状态：<@eu.comboBox disabled="true" name="publishStatu" url="common.do?loadComboBox&key=MATCH_PUBLISH_STATU&value=${(matchIntroduceItem.publishStatu)!'2'}" />
					
				</td>
			</tr>
			<tr>
				<td>
					<textarea id="matchInstroduceTxt${(matchProjectItem.id)!}" style="width: 100%; height: 200px;" class="easyui-validatebox" data-options="required: false" name="matDesc">${(matchIntroduceItem.matDesc)!}</textarea>
				</td>
			</tr>
		</table>
	</div>
	<div data-options="region:'south',border:false">
		<div style="padding:3px 0;border-top:1px solid #95B8E7;text-align: center;">
			<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="saveMatchIntroduce()">保存</a>
			<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="skipMatchIntroduceLook()">预览</a>
			<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="publishMatchIntroduce()">发布</a>
	    </div>
	</div>
</div>

<script>
//初始化赛事介绍框
CKEDITOR.replace('matchInstroduceTxt${(matchProjectItem.id)!}');
//保存赛事介绍
function saveMatchIntroduce() {
	var id = $('#matchInstroduceId${(matchProjectItem.id)!}').val();
	var matchProjectId = $('#matchProjectId${(matchProjectItem.id)!}').val();
	
	var txt = CKEDITOR.instances.matchInstroduceTxt${(matchProjectItem.id)!}.getData();
	if(isNotEmpty(txt)) {
		var data = {id:id,matchProjectId:matchProjectId,matDesc:txt};
		printLog(data);
	  $.post('matchIntroduce.do?saveMatchIntroduce',data,function(result){
		  //回填id
		  if(result.success) {
			  $('#matchInstroduceId${(matchProjectItem.id)!}').val(result.obj);
		  }
	      showMsg(result.msg);
	  },'json');
	}else {
		showMsg('请输入介绍内容');
	}
	
	
	
}

//预览跳转
function skipMatchIntroduceLook() {
	var id = $('#matchInstroduceId${(matchProjectItem.id)!}').val();
	if(isNotEmpty(id)) {
		window.open('cms.action?skip&navCode=sshdXq&look=1&subNav=ssjs&sshdId=${(matchProjectItem.id)!}');
	} else {
		showMsg('请先保存');
	}
}
//发布
function publishMatchIntroduce() {
	var txt = CKEDITOR.instances.matchInstroduceTxt${(matchProjectItem.id)!}.getData();
	if(isNotEmpty(txt)) {
		var id = $('#matchInstroduceId${(matchProjectItem.id)!}').val();
		if(isNotEmpty(id)) {
			$.messager.confirm('询问','你确认要发布吗?',function(r){
		        if (r){
		        	 $.post('matchIntroduce.do?publishMatchInstroduce',{id:id},function(result){
		                 showMsg(result.msg);
		                 if(result.success) {
		                	 var currTab =  $('#managerMatchProjectTabs').tabs('getSelected'); //获得当前tab
		                	 currTab.panel('refresh');
		                 }
		             },'json');
		        }
		    });
		} else {
			showMsg('请先保存');
		}
	}else {
		showMsg('请输入介绍内容');
	}
	
	
}
</script>
